//
//  ViewController.m
//  jishuqi
//
//  Created by mac on 16-3-1.
//  Copyright (c) 2016年 zhanglinjun. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(IBAction)method{
    NSString * text1 = self.texeField1.text;
     NSString * text2 = self.texeField2.text;
    int num1 = [text1 intValue];
    int num2 = [text2 intValue];
    int result = 0;
    NSString * yunsuanfu = self.pl.text;
    char ysf =[yunsuanfu characterAtIndex:0];
    switch (ysf) {
        case '+':
            result =num1 + num2;
            break;
        case '-':
            result =num1 - num2;
            break;
        case '*':
            result =num1 * num2;
            break;
        case '/':
            result =num1 / num2;
            break;
        default:
            break;
            
    }
    /*result = num1 - num2;
    result = num1 + num2;
    result = num1 * num2;
    result = num1 / num2;*/
    
NSString * output = [NSString stringWithFormat:@"%d",result];
    self.res.text = output;
    
    NSLog(@"计算器按钮被点击了");
    
    NSLog(@"%@",text1);
    NSLog(@"%@",text2);
    NSLog(@"%d",result);
  
    [self.view endEditing:YES];
}
-(IBAction)plus{
self.pl.text = @"+";


}
-(IBAction)jian{
self.pl.text =@"-";

}

-(IBAction)chen{
self.pl.text =@"*";
}
-(IBAction)chu{
self.pl.text =@"/";

}

@end
